package ai.peanut.cloudtwo.service.kafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

@Component
public class KafkaSender {
    @Autowired
    private KafkaTemplate<String, String> kafkaTemplate;

    //发送消息方法
    public void send() {

        System.out.println("+++++++++++++++++++++kkkkk");
        kafkaTemplate.send("key1", "+++++++++++++++++++++kkkkk");
    }
}
